/**
* Created by yyr on 2018/3/15
*已设立基金》管理费核定
*/
<template>
    <div>
        <div class="ca-box-border-top-none ca-p-22" v-if="!isManageAssessmentEdit">
            <el-row>
                <el-col :span="12" class="ca-title">
                    <h3>管理费</h3>
                </el-col>
                <el-col :span='12' class="ca-align-right">
                    <el-button
                        type="text"
                       @click="fundManageAssEdit()"
                        :disabled="!isAuthMoneyEdit"
                       class="ca-edit-btn el-icon-edit">编辑</el-button>
                </el-col>
            </el-row>
            <el-table
                :data="costData"
                stripe
                border
                style="width:100%" class="table_p_01 ca-m-t-15 ca-table">
                <el-table-column
                    prop="particularYear"
                    label="年份">
                    <template slot-scope="scope">
                        {{scope.row.particularYear?$moment( scope.row.particularYear).format("YYYY"):''}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="fundState"
                    label="基金状态">
                    <template slot-scope="scope">
                        {{scope.row.fundState | getNameById('fundCostState')}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="proportion"
                    label="管理费比例(%)">
                </el-table-column>
                <el-table-column
                    prop="computingBase"
                    label="计算基数">
                </el-table-column>
                <el-table-column
                    peop="payment"
                    label="计划支付(元)">
                    <template slot-scope="scope">
                        {{scope.row.payment | format1}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="paid"
                    label="实付(元)">
                    <template slot-scope="scope">
                        {{scope.row.paid | format1}}
                    </template>
                </el-table-column>
                <el-table-column
                    prop="remarks"
                    label="备注">
                </el-table-column>
            </el-table>
        </div>
        <csManageAssessmentEdit
            v-if="isManageAssessmentEdit"
            @isEdit="isEdit"
            @addRedDot="addRedDot"
            :costDataList="costData"
        >
        </csManageAssessmentEdit>
    </div>
</template>

<script type="text/ecmascript-6">
    import {api} from '../api';
    import {STATUS_HTTP_SUCCESS, apiHttp} from '__service/csHttp';
    import {isNoAuth} from '__service/utils';
    export default {
        data() {
            return {
                isAuthMoneyEdit: isNoAuth('已投资基金-管理费核定-编辑'),
                isManageAssessmentEdit: false,
                itemId: this.$route.params.fundId,
                costData: [],
            }
        },
        props: {
        },
        created() {
            this.getCost();
        },
        methods: {
            getCost() {
                apiHttp(api.GET_COST,{fundId: this.itemId}).then( ret=>{
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        this.costData = ret.data;
                    }
                })
            },
            fundManageAssEdit() {
                this.isManageAssessmentEdit = true;
            },
            isEdit(val) {
                this.isManageAssessmentEdit = val;
                this.getCost();
            },
            addRedDot() {
                this.$emit('addRedDot', 2)
            }
        },
        components: {
            'csManageAssessmentEdit': require('./edit.vue'),
        },
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
